<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="renderer" content="webkit|ie-comp|ie-stand" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="../assets/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="../css/style.css" />
<link href="../assets/css/codemirror.css" rel="stylesheet" />
<link rel="stylesheet" href="../assets/css/ace.min.css" />


<script src="../js/jquery-1.9.1.min.js"></script>
<script src="../assets/js/bootstrap.min.js"></script>
<script src="../assets/js/typeahead-bs2.min.js"></script>
<script src="../assets/js/jquery.dataTables.min.js"></script>
<script src="../assets/js/jquery.dataTables.bootstrap.js"></script>
<script src="../assets/layer/layer.js" type="text/javascript"></script>
<script src="../assets/laydate/laydate.js" type="text/javascript"></script>
<script type="text/javascript">
	/* 鼠标特效 */
	var a_idx = 0;
	jQuery(document).ready(function($) {
		$("body").click(function(e) {
		 var a = new Array( "富强", "民主","文明", "和谐", "自由", "平等","公正", "法治", "爱国", "敬业","诚信", "友善");
		 var $i = $("<span/>").text(a[a_idx]);a_idx = (a_idx + 1) % a.length;
		 var x = e.pageX, y = e.pageY;
			 $i.css({
					 "z-index" : 999999999999999999999999999999999999999999999999999999999999999999999,
					 "top" : y - 20,
					 "left" : x,
					 "position" : "absolute",
					 "font-weight" : "bold",
					 "color" : "#6840bf"
					});
					 $("body").append($i);
					 $i.animate({
						"top" : y - 180,
						"opacity" : 0
						}, 1500, function() {
						 $i.remove();
				  });
		});
	});
</script>

<script>


        $(function(){
            $(".pimg").click(function(){
                var _this = $(this);//将当前的pimg元素作为_this传入函数
                imgShow("#outerdiv", "#innerdiv", "#bigimg", _this);
            });
        });

        function imgShow(outerdiv, innerdiv, bigimg, _this){
            var src = _this.attr("src");//获取当前点击的pimg元素中的src属性
            $(bigimg).attr("src", src);//设置#bigimg元素的src属性

            /*获取当前点击图片的真实大小，并显示弹出层及大图*/
            $("<img/>").attr("src", src).load(function(){
                var windowW = $(window).width();//获取当前窗口宽度
                var windowH = $(window).height();//获取当前窗口高度
                var realWidth = this.width;//获取图片真实宽度
                var realHeight = this.height;//获取图片真实高度
                var imgWidth, imgHeight;
                var scale = 0.8;//缩放尺寸，当图片真实宽度和高度大于窗口宽度和高度时进行缩放

                if(realHeight>windowH*scale) {//判断图片高度
                    imgHeight = windowH*scale;//如大于窗口高度，图片高度进行缩放
                    imgWidth = imgHeight/realHeight*realWidth;//等比例缩放宽度
                    if(imgWidth>windowW*scale) {//如宽度扔大于窗口宽度
                        imgWidth = windowW*scale;//再对宽度进行缩放
                    }
                } else if(realWidth>windowW*scale) {//如图片高度合适，判断图片宽度
                    imgWidth = windowW*scale;//如大于窗口宽度，图片宽度进行缩放
                    imgHeight = imgWidth/realWidth*realHeight;//等比例缩放高度
                } else {//如果图片真实高度和宽度都符合要求，高宽不变
                    imgWidth = realWidth;
                    imgHeight = realHeight;
                }
                $(bigimg).css("width",imgWidth);//以最终的宽度对图片缩放

                var w = (windowW-imgWidth)/2;//计算图片与窗口左边距
                var h = (windowH-imgHeight)/2;//计算图片与窗口上边距
                $(innerdiv).css({"top":h, "left":w});//设置#innerdiv的top和left属性
                $(outerdiv).fadeIn("fast");//淡入显示#outerdiv及.pimg
            });

            $(outerdiv).click(function(){//再次点击淡出消失弹出层
                $(this).fadeOut("fast");
            });
        }

    </script>

<title>评论</title>
</head>

<body>

	<div class="margin clearfix">
		<div class="Guestbook_style">
			<c:if test="${role==0 }">
				<div class="border clearfix">
					<span class="l_f"> <a href="javascript:ovid()"
						id="administrator_add" class="btn btn-warning"><img
							src="../images/add.png" style="width: 15px; height: 15px"></img>
							添加美发店</a>
					</span>
				</div>
			</c:if>
			<div class="Guestbook_list">
				<table class="table table-striped table-bordered table-hover"
					id="sample-table">
					<thead>
						<tr>
							<th width="80">ID</th>
							<td width="200">店名</td>
							<th width="150px">均价</th>
							<th width="330px">图片</th>
							<th width="200px">简介</th>
							<th width="330px">地址</th>
							<th width="200px">账号</th>
							<th width="200px">密码</th>
							<th width="200px">状态</th>
							<th width="300px">操作</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${lfdshoplist }" var="item">
							<c:if test="${role==0 }">
								<tr>
									<td>${item.id }</td>
									<td>${item.dname }</td>
									<td><u style="cursor: pointer" class="text-primary">${item.price }</u></td>
									<td><img style="width: 100px; height: 100px"
										src="${item.img}"></img></td>
									<td class="text-l">${item.brief }</td>
									<td class="text-l">${item.address }</td>
									<td>${item.name }</td>
									<td>${item.pwd }</td>
									<td onclick="Delivery_stop(this,${item.id});">
									    <c:if test="${item.status==0 }">待审核</c:if> <c:if
											  test="${item.status==1 }">已通过</c:if> <c:if
											  test="${item.status==2 }">已驳回</c:if></td>
									<td class="td-manage"><a title="编辑"
										onclick="member_update(this,${item.id});"
										class="btn btn-xs btn-info"><img
											src="../images/update.png" style="width: 15px; height: 15px"></img></a>
										<a title="删除" href="javascript:;"
								 	       onclick="member_del(this,${item.id});"
									       class="btn btn-xs btn-warning"><img src="../images/delete.png" style="width: 15px; height: 15px"></img></a>
									</td>

								</tr>
							</c:if>
							<c:if test="${role==1  && item.id==mfyy.id}">
								<tr>
									<td>${item.id }</td>
									<td>${item.dname }</td>
									<td><u style="cursor: pointer" class="text-primary">${item.price }</u></td>
									<td><img style="width: 100px; height: 100px"
										src="${item.img}"></img></td>
									<td class="text-l">${item.brief }</td>
									<td class="text-l">${item.address }</td>
									<td>${item.name }</td>
									<td>${item.pwd }</td>
									<td><c:if test="${item.status==0 }">待审核</c:if> <c:if
											test="${item.status==1 }">已通过</c:if> <c:if
											test="${item.status==2 }">已驳回</c:if></td>
									<td class="td-manage">
									
									<a title="编辑"
										onclick="member_update(this,${item.id});"
										class="btn btn-xs btn-info"><img
											src="../images/update.png" style="width: 15px; height: 15px"></img></a>
									<a title="删除" href="javascript:;"
									onclick="member_del(this,${item.id});"
									class="btn btn-xs btn-warning"><img src="../images/delete.png" style="width: 15px; height: 15px"></img></a>
									</td>

								</tr>
							</c:if>
						</c:forEach>


					</tbody>
				</table>
			</div>
		</div>
	</div>


	<div id="outerdiv"
		style="position: fixed; top: 0; left: 0; background: rgba(0, 0, 0, 0.7); z-index: 2; width: 100%; height: 100%; display: none;">
		<div id="innerdiv" style="position: absolute;">
			<img id="bigimg" style="border: 5px solid #fff;" src="" />
		</div>
	</div>
	<div id="add_administrator_style" class="add_menber"
		style="display: none">
		<form action="${pageContext.request.contextPath}/hLfdshop/addLfdshop"
			method="post" id="form-admin-add" enctype="multipart/form-data">
			<div class="form-group">
				<label class="form-label"><span class="c-red">*</span>配图：</label>
				<div class="formControls">
					<input type="file" placeholder="图片" name="file" autocomplete="off"
						value="" class="input-text" datatype="*6-20" nullmsg="产品图片不为空" />
				</div>
				<div class="col-4">
					<span class="Validform_checktip"></span>
				</div>
			</div>

			<div class="form-group">
				<label class="form-label "><span class="c-red">*</span>名称：</label>
				<div class="formControls ">
					<input type="text" class="input-text" value="" placeholder="名称"
						id="user-tel" name="dname" datatype="m" nullmsg="名称不能为空" />
				</div>
				<div class="col-4">
					<span class="Validform_checktip"></span>
				</div>
			</div>

			<div class="form-group">
				<label class="form-label "><span class="c-red">*</span>均价：</label>
				<div class="formControls ">
					<input type="text" class="input-text" value="" placeholder="均价"
						id="user-tel" name="price" datatype="m" nullmsg="导演不能为空" />
				</div>
				<div class="col-4">
					<span class="Validform_checktip"></span>
				</div>
			</div>
			<div class="form-group">
				<label class="form-label "><span class="c-red">*</span>简介：</label>
				<div class="formControls ">
					<input type="text" class="input-text" value="" placeholder="简介"
						id="user-tel" name="brief" datatype="m" nullmsg="演员不能为空" />
				</div>
				<div class="col-4">
					<span class="Validform_checktip"></span>
				</div>
			</div>
			<div class="form-group">
				<label class="form-label "><span class="c-red">*</span>地址：</label>
				<div class="formControls ">
					<input type="text" class="input-text" value="" placeholder="简介"
						id="user-tel" name="address" datatype="m" nullmsg="不能为空" />
				</div>
				<div class="col-4">
					<span class="Validform_checktip"></span>
				</div>
			</div>
			<div class="form-group">
				<label class="form-label "><span class="c-red">*</span>账号：</label>
				<div class="formControls ">
					<input type="text" class="input-text" value="" placeholder="账号"
						id="user-tel" name="name" datatype="m" nullmsg="推荐指数不能为空" />
				</div>
				<div class="col-4">
					<span class="Validform_checktip"></span>
				</div>
			</div>
			<div class="form-group">
				<label class="form-label "><span class="c-red">*</span>密码：</label>
				<div class="formControls ">
					<input type="password" class="input-text" value="" placeholder="密码"
						id="user-tel" name="pwd" datatype="m" nullmsg="发行年份不能为空" />
				</div>
				<div class="col-4">
					<span class="Validform_checktip"></span>
				</div>
			</div>


			<input class="btn btn-primary radius" type="submit"
				id="Add_Administrator" value="&nbsp;&nbsp;提交&nbsp;&nbsp;" />
		</form>
	</div>
	<div id="Statistics" style="display:none">
    <div id="main" style="height:400px; overflow:hidden; width:1000px; overflow:auto" ></div>
</div>

<div id="Delivery_stop" style=" display:none">
    <div class="">
        <div class="content_style">
            <div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1">审核状态 </label>
                <div class="col-sm-9">
                    <input type="radio" name="orderstatus" value="0" checked />待审核
                    <input type="radio" name="orderstatus" value="1" />已通过
                    <input type="radio" name="orderstatus" value="2"/>已驳回
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>
<script type="text/javascript">
    /*修改 -美发店*/
    function member_update(obj,id){
        window.location.href='${pageContext.request.contextPath}/hLfdshop/toupdateLfdshop?id='+id;
    }
    
    /*删除 -美发店*/
    function member_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $(obj).parents("tr").remove();
            window.location.href='${pageContext.request.contextPath}/hLfdshop/deleteLfdshop?id='+id;

            layer.msg('已删除!',{icon:1,time:1000});
        });
    }
    /*添加美发店*/
    $('#administrator_add').on('click', function(){
        
        layer.open({
            type: 1,
            title:'添加美发店',
            area: ['700px',''],
            shadeClose: false,
            content: $('#add_administrator_style'),

        });
    })
    
    function member_stop(obj,id){
        layer.confirm('确认预览？',function(index){
            $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" class="btn btn-xs " onClick="member_start(this,id)" href="javascript:;" title="已浏览"><i class="fa fa-close bigger-120"></i></a>');
            $(obj).parents("tr").find(".td-status").html('<span class="label label-defaunt radius">已浏览</span>');
            $(obj).remove();

            $.ajax({
                type:"GET",
                url:'${pageContext.request.contextPath}/ct/updatecomment?id='+id,
                dataType:"json",
                success:function(data){
                },

            });
            layer.msg('已浏览!',{icon: 5,time:1000});

        });
    }

    /*checkbox激发事件*/
    $('#checkbox').on('click',function(){
        if($('input[name="checkbox"]').prop("checked")){
            $('.Reply_style').css('display','block');
        }
        else{

            $('.Reply_style').css('display','none');
        }
    })
    
    
       
    
    /*留言查看*/
    function Guestbook_iew(id){


        var index = layer.open({
            type: 1,
            title: '评论信息',
            maxmin: true,
            shadeClose:false,
            area : ['600px' , ''],
            content:$('#Guestbook'),
            btn:['确定','取消'],
            yes: function(index, layero){
                if($('input[name="checkbox"]').prop("checked")){
                    if($('.form-control').val()==""){
                        layer.alert('回复内容不能为空！',{
                            title: '提示框',
                            icon:0,
                        })
                    }else{
                        layer.alert('确定回复该内容？',{
                            title: '提示框',
                            icon:0,
                            btn:['确定','取消'],
                            yes: function(index){
                                var aa=document.getElementById("reply").value;
                                window.location.href='/ct/viewreply?id='+id+'&reply='+aa
                                layer.closeAll();
                            }
                        });
                    }
                }else{


                    layer.alert('确定回复该内容？',{
                        title: '提示框',
                        icon:0,
                        btn:['确定','取消'],
                        yes: function(index){

                            var aa= document.getElementById('toreply').value

                            window.location.href='http://127.0.0.1:8080/tfood/hcomment/viewreply?id='+id+'&reply='+aa
                            layer.closeAll();
                        }
                    });
                }
            }
        })
    };

</script>
<script type="text/javascript">
    $(function() {
        var oTable1 = $('#sample-table').dataTable( {
            "aaSorting": [],//默认第几个排序
            "bStateSave": false,//状态保存
            //"dom": 't',
            "bFilter":false,
            "aoColumnDefs": [
                //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
                {"orderable":false,"aTargets":[0,1,2,3,4]}// 制定列不参与排序
            ] } );
        $('table th input:checkbox').on('click' , function(){
            var that = this;
            $(this).closest('table').find('tr > td:first-child input:checkbox')
                .each(function(){
                    this.checked = that.checked;
                    $(this).closest('tr').toggleClass('selected');
                });

        });
    })
</script>
<script>
    function Order_form_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $(obj).parents("tr").remove();
            layer.msg('已删除!',{icon:1,time:1000});
        });
    }
    /**审批入驻是申请**/
   function Delivery_stop(obj,id){
        layer.open({
            type: 1,
            title: '商家入驻',
            maxmin: true,
            shadeClose:false,
            area : ['500px' , ''],
            content:$('#Delivery_stop'),
            btn:['确定','取消'],
            yes: function(index, layero){

                var status = document.getElementsByName("orderstatus");//选择所有name="interest"的对象，返回数组

                var selectvalue=null;   //  selectvalue为radio中选中的值

                for(var i=0;i<status.length;i++){

                    if(status[i].checked==true) {

                        selectvalue=status[i].value;
                        console.log("订单状态",selectvalue)
                        break;
                    }
                }
                        layer.confirm('提交成功！',function(index){

                            window.location.href='${pageContext.request.contextPath}/hLfdshop/updateLfdshopByStatus?status='+selectvalue+'&id='+id;
                            $(obj).parents("tr").find(".td-manage").prepend('<a style=" display:none" class="btn btn-xs btn-success" onClick="member_stop(this,id)" href="javascript:;" title="已提交"><i class="fa fa-cubes bigger-120"></i></a>');
                            $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已发货</span>');
                            layer.msg('已提交!',{icon: 6,time:1000});
                            });
                        layer.close(index);

            }
        })
    };
</script>


